import bpy
import bpy.utils.previews

# 用于UI的icon读取
UI_PREV = bpy.utils.previews.new()
#           自定义标识符   图片路径
UI_PREV.load("MYICON", "/Users/karrycharon/Desktop/asset/模板/CL-打光道具/SCL-C型背景板.png", 'IMAGE')
# icon_value=UI_PREV['MYICON'].icon_id


class HelloWorldPanel(bpy.types.Panel):
    bl_idname = "OBJECT_PT_hello_world"
    bl_label = "Label"
    bl_space_type = 'PROPERTIES'
    bl_region_type = 'WINDOW'
    bl_context = "object"

    def draw(self, context):
        layout = self.layout
        col = layout.column()
        col.label(text="MyTools")
        row = layout.row()
        row.operator("object.select_all")
        row.operator("a_test.test_ops1")
        box = layout.box()
        for o in bpy.data.objects:
            # object.location
            box.prop(o, "location")
            # object.name
            box.prop(o, "name", icon_value=UI_PREV['MYICON'].icon_id)

    def draw_header(self, context):
        self.layout.label(text="MyPanel")


bpy.utils.register_class(HelloWorldPanel)
